import requests

from api.basic_api import BaseBuyerApi
from common.encry_decry import md5
from common.file_load import load_yaml_file


class BuyerLoginApi(BaseBuyerApi):
    def __init__(self,username,password):
        super().__init__()#继承父类属性
        # self.session=requests.session()
        self.url =f'{self.host}/passport/login'
        # self.headers = {"Authorization": ""}
        # 表单参数
        self.method ='post'
        self.data = {
            "username": username,
            "password": md5(password).upper(),  # abc123456
            "captcha": load_yaml_file('/config/common.yml')['captcha'],
            "uuid": "sdahhadsjhashdhjsdh"
        }
        #接口调用
    # def send(self):
    #     self.resp=self.session.request(method=self.method,
    #                          url=self.url,
    #                          headers=self.headers,
    #                          data=self.data)
    #     return self.resp
if __name__ == '__main__':
    buy_login_api=BuyerLoginApi().send()
    print(buy_login_api.text)
